﻿using System;
using System.Collections.Generic;
using System.Text;

namespace SocketLib.ex
{
	/// <summary>
	/// 远程关闭的异常
	/// </summary>
	public class RemoteClosedException : Exception
	{
		public RemoteClosedException() : base("远程连接关闭") { }
		public RemoteClosedException(string message) : base(message) { }

	}

	/// <summary>
	/// 客户端异常关闭 Disconnect
	/// </summary>
	public class ClientClosedException : Exception
	{
		public ClientClosedException() : base("远程连接关闭") { }
		public ClientClosedException(string message) : base(message) { }

	}


	/// <summary>
	/// 数据长度错误
	/// </summary>
	public class DataLengthException : Exception
	{
		public DataLengthException() : base("数据长度错误") { }
		public DataLengthException(string message) : base(message) { }
	}
	/// <summary>
	/// PieceHash应为32长度的字节数组
	/// </summary>
	public class HashLengthException : DataLengthException
	{
		public HashLengthException() : base("Hash长度错误") { }
		public HashLengthException(string message) : base(message) { }
	}
	/// <summary>
	/// Session应为32长度的字节数组
	/// </summary>
	public class SessionLengthException : DataLengthException
	{
		public SessionLengthException() : base("Session应为32长度的字节数组") { }
		public SessionLengthException(string message) : base(message) { }
	}
	/// <summary>
	/// 发送数据时异常
	/// </summary>
	public class SendDataException : Exception
	{
		public SendDataException() : base("发送数据时异常") { }
		public SendDataException(string message) : base(message) { }
	}
	/// <summary>
	/// 参数异常
	/// </summary>
	public class ParameterException : Exception
	{
		public ParameterException() : base("参数异常") { }
		public ParameterException(string message) : base(message) { }
	}
	/// <summary>
	/// 参数是只读的
	/// </summary>
	public class OnlyReadParameterException : ParameterException
	{
		public OnlyReadParameterException() : base("参数是只读的") { }
		public OnlyReadParameterException(string message) : base(message) { }
	}
	/// <summary>
	/// 参数不能为空
	/// </summary>
	public class NotNullParameterException : ParameterException
	{
		public NotNullParameterException() : base("参数不能为空") { }
		public NotNullParameterException(string message) : base(message) { }
	}
	/// <summary>
	/// 参数值错误
	/// </summary>
	public class ValueParameterException : ParameterException
	{
		public ValueParameterException() : base("参数值错误") { }
		public ValueParameterException(string message) : base(message) { }
	}
	/// <summary>
	/// 数据包异常
	/// </summary>
	public class PackageException : Exception
	{
		public PackageException() : base("数据包异常") { }
		public PackageException(string message) : base(message) { }
	}
	/// <summary>
	/// 数据包版本错误
	/// </summary>
	public class PackageVersionException : PackageException
	{
		public PackageVersionException() : base("数据包版本错误") { }
		public PackageVersionException(string message) : base(message) { }
	}
	/// <summary>
	/// 数据包加密解密失败
	/// </summary>
	public class PackageEncryptException : PackageException
	{
		public PackageEncryptException() : base("数据包加密解密失败") { }
		public PackageEncryptException(string message) : base(message) { }
	}
	/// <summary>
	/// 数据包验证失败
	/// </summary>
	public class PackageValidateException : PackageException
	{
		public PackageValidateException() : base("数据包验证失败") { }
		public PackageValidateException(string message) : base(message) { }
	}
	/// <summary>
	/// 管道异常
	/// </summary>
	public class ConduitException : Exception
	{
		public ConduitException() : base("管道异常") { }
		public ConduitException(string message) : base(message) { }
	}
	/// <summary>
	/// 管道数据异常
	/// </summary>
	public class ConduitDataException : ConduitException
	{
		public ConduitDataException() : base("管道数据异常") { }
		public ConduitDataException(string message) : base(message) { }
	}
	/// <summary>
	/// 没有确认数据
	/// </summary>
	public class NoNotarizeDataException : Exception
	{
		public NoNotarizeDataException() : base("没有确认数据") { }
		public NoNotarizeDataException(string message) : base(message) { }
	}
	/// <summary>
	/// 缓存异常
	/// </summary>
	public class BufferException : Exception
	{
		public BufferException() : base("缓存异常") { }
		public BufferException(string message) : base(message) { }
	}
	/// <summary>
	/// 管道状态异常
	/// </summary>
	public class ConduitStateException : ConduitException
	{
		public ConduitStateException() : base("管道状态异常") { }
		public ConduitStateException(string message) : base(message) { }
	}



}

